import java.util.Locale;
import java.util.Scanner;

public class LOVE {

    public static  String toLowerCase(String str)
    {
        String s=str.toLowerCase();
        return s;
    }
    public static void main2(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        String ret=toLowerCase(str);
        System.out.println(ret);
    }

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        Solution solution = new Solution();
        int count= solution.countSegments(str);
        System.out.println(count);
    }
}
class Solution {
    public  int countSegments(String s) {
        s = s.trim();
        if( s == null || s.isEmpty() ){
            return 0;
        }
        String[] str = s.split(" ");
        int count = 0;
        for (int i = 0; i < str.length; i++) {
            //里面是空格的不算，有可能多个空格
            if(str[i].isEmpty()) {
                continue;
            }
            count ++;
        }
        return count;
    }
}